// src/store/index.js

import { createStore } from 'vuex';

export default createStore({
    state: {
        // 控制全局加载动画的显示状态
        isSpinning: false,
    },
    mutations: {
        // 设置加载状态
        SET_SPINNING(state, value) {
            state.isSpinning = value;
        }
    },
    actions: {
        // 控制显示加载动画
        spinShow({ commit }, value) {
            commit('SET_SPINNING', value);
        }
    },
    getters: {
        // 获取加载状态
        isSpinning: (state) => state.isSpinning,
    }
});
